home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib15.dsk
/
APPLE IIE CHARACTER SET DEMO.bas
next >
Wrap
BASIC Source File
|
2023-02-26
|
4KB
|
63 lines
100 REM ***********************************************************
110 REM * *
120 REM * Apple //e CHARACTER SET DEMO: Displays alternate and *
130 REM * primary character sets with 80 column card on and off *
140 REM * *
150 REM * by Sandy Mossberg *
160 REM * *
170 REM ***********************************************************<CTRL-J>
180 REM Machine language subroutines and equates:
190 REM 768 COUTSP LDA $06
200 REM 770 JSR $FDED ;print character in $06 (ASCII)
210 REM 773 OUTSP JMP $DB57 ;print space
220 REM 776 PRHEX LDA $07
230 REM 778 JMP $FDE3 ;print low nybble in $07 (HEX)<CTRL-J>
240 FOR I = 768 TO 780: READ N: POKE I,N: NEXT I
250 DATA 165,6,32,237,253,76,87,219,165,7,76,227,253
260 CHAR = 6:NYBBLE = 7:COUTSP = 768:OUTSP = 773:PRHEX = 776: REM <CTRL-J>
270 REM Soft switch equates:
280 REM ALTCHARSET: OFF (FALT) = 49166 ($C00E)
290 REM ON (NALT) = 49167 ($C00F)
300 REM READ (RALT) = 49182 ($C01E)
310 REM PAGE2: OFF (FPG2) = 49236 ($C054)
320 REM ON (NPG2) = 49237 ($C055)<CTRL-J>
330 FALT = 49166:NALT = 49167:RALT = 49182:FPG2 = 49236:NPG2 = 49237: REM <CTRL-J>
340 REM Read character set and print it on top line.<CTRL-J>
350 HOME : IF PEEK(RALT) >128 THEN GOSUB 710: GOTO 380
360 GOSUB 720: REM <CTRL-J>
370 REM Print column headers ("ones place").<CTRL-J>
380 PRINT : HTAB 5: FOR I = 0 TO 15: POKE NYBBLE,I: CALL PRHEX: CALL OUTSP: NEXT I: PRINT : PRINT : REM <CTRL-J>
390 REM Print row headers ("tens place").<CTRL-J>
400 FOR I = 0 TO 255 STEP 16: POKE NYBBLE,I/16: CALL PRHEX: POKE NYBBLE,0: CALL PRHEX: REM <CTRL-J>
410 REM Determine 80 column card (slot 3) activity by checking
420 REM for $C3 (195) in high order byte of output hook (55,$37)
430 REM or true output handler of DOS (43604,$AA54).<CTRL-J>
440 IF PEEK(55) < >195 AND PEEK(43604) < >195 THEN 520: REM <CTRL-J>
450 REM 80 column card active. Non-control characters print normally.<CTRL-J>
460 IF I < >0 AND I < >16 AND I < >128 AND I < >144 THEN 530: REM <CTRL-J>
470 REM 80 column card active. Convert positive ASCII control
480 REM characters to normal characters and mark them.<CTRL-J>
490 IF I = 0 OR I = 16 THEN PRINT "->";: FOR J = I TO I +15: POKE CHAR,J +192: GOTO 540: REM <CTRL-J>
500 REM 80 column card active or inactive. Convert negative ASCII
510 REM control characters to normal characters and mark them.<CTRL-J>
520 IF I = 128 OR I = 144 THEN PRINT "->";: FOR J = I TO I +15: POKE CHAR,J +64: GOTO 540
530 PRINT " ";: FOR J = I TO I +15: POKE CHAR,J
540 CALL COUTSP: NEXT J: PRINT : NEXT I: REM <CTRL-J>
550 REM Control line - switch character sets or end.<CTRL-J>
560 VTAB 23: PRINT "SWITCH or END (ANY KEY/E)? ";
570 VTAB 23: HTAB 28: GET A$: REM <CTRL-J>
580 REM End it all.<CTRL-J>
590 IF A$ = "E" THEN END : REM <CTRL-J>
600 REM Switch. Read 80 column card activity.<CTRL-J>
610 IF PEEK(55) = 195 OR PEEK(43604) = 195 THEN 690: REM <CTRL-J>
620 REM Read first screen character on text page 1. If "A" then
630 REM switch to primary set; if "P", switch to secondary set.<CTRL-J>
640 IF CHR$( PEEK(1024) -128) = "A" THEN POKE FALT,0: POKE FPG2,0: GOSUB 720: GOTO 570
650 POKE FPG2,0: POKE NALT,0: GOSUB 710: GOTO 570: REM <CTRL-J>
660 REM If 80 column card active, to read first character on text
670 REM page 1 (even numbered column), turn auxilliary memory
680 REM ("PAGE2") on. Truth is stranger than fiction!<CTRL-J>
690 POKE NPG2,0: GOTO 640: REM <CTRL-J>
700 REM Subroutines to print title on top line.<CTRL-J>
710 PRINT : VTAB 1: PRINT "ALTERNATE CHARACTER SET:": RETURN
720 PRINT : VTAB 1: PRINT "PRIMARY CHARACTER SET: ": RETURN